import 'package:flutter/cupertino.dart';
import 'package:flutter_basic_learning/utils/CommonWidget.dart';
import 'package:flutter_basic_learning/views/getx/get_view/GetViewPageTwo.dart';
import 'package:get/get.dart';

import '../get_view/GetViewDataShareController.dart';

class GetViewPageOne extends GetView<GetViewDataShareController> {
  const GetViewPageOne({super.key});

  @override
  Widget build(BuildContext context) {
    // 没有配置全局依赖注入配置器时，需要手动配置依赖注入；
    // 如果配置了全局依赖注入配置器，则可忽略下方代码

    return commonScaffold('GetView - 页面1', [
      Obx(() => commonText('全局数据共享： ${controller.count.value}')),
      commonButton('count+1', () {
        controller.count.value++;
      }),
      commonButton('跳转页面2', () {
        Get.to(() => const GetViewPageTwo());
      })
    ]);
  }
}
